import requests

cookies = {
    'shshshfpa': 'e3434066-7c6b-cbb2-eec0-0281f8037ee3-1643567850',
    'shshshfpb': 'bpWSgf9qV6ae2dzFR9JxtMw',
    '__jdu': '16637696330571646021827',
    'pinId': 'vbCchuSa_NQKSbvfzEC03bV9-x-f3wj7',
    'b_dw': '1512',
    'b_dh': '834',
    'b_dpr': '2',
    'b_webp': '1',
    'b_avif': '1',
    'unick': 'jd_183368wbf',
    '_tp': 'yffpj4pbi6WVLmf%2BbKimWgj7K7xxpICgwOKfwjBeIM0%3D',
    '_pst': 'jd_785d2089dc239',
    'shshshfpx': 'e3434066-7c6b-cbb2-eec0-0281f8037ee3-1643567850',
    'pin': 'jd_785d2089dc239',
    'areaId': '12',
    'ipLoc-djd': '12-988-993-58088',
    'PCSYCityID': 'CN_320000_320500_0',
    'TrackID': '1MzBljf882tTrpTsVJ8KJPp-H6jsNgUzoZxwpqBvrPEvfeWMv9UwhC4NYXRdMP_q8Q_MItygnvR4ovCcrkeA1lJUhPfQhnqLuONzttFOadlJ-lv2TKKMA9Mt7ZxbmjRwu',
    'ceshi3.com': '103',
    'auid': '19705016',
    'autype': '0',
    'auname': 'jd_183368wbf',
    'aupic': 'https%3A%2F%2Fstorage.360buyimg.com%2Fi.imageUpload%2F6a645f3738356432303839646332333931353736383130363132353537_big.jpg',
    'disour': '1',
    'jsavif': '1',
    'shshshfp': '577897c2824a85ebbd0fc42d2e96a54d',
    'thor': 'AABCE4359EC6604D1E910EABE31C93AA7FCF79DDC53AF27CFC346701D54E27E7BD6F4387BF6B4637F9BB96B4F9B681FF69E161721CA72090BE8056BDC34ED3664FA4F407600A6E8262D08907024D75CD46AE6E9CD270BBA7F202AD87E2002F431059F891204620A068009E9F6964A5D98946AED2A1CB01A0A1E7D6ED9D229C33A1131C086FCD6FFBF3C9432A27410A0844DFFD0EA0A61BC29275451925383013',
    '3AB9D23F7A4B3C9B': 'VJLAKPFVJKFZSK5JQI4IZDKVRFR7RJFQOYBTFFEM4PUUAFC2DVWIKQGRU7NT5AJMKGQD3HPU4YX2Q54E2QJR3HK35I',
    'shshshsID': 'd50ad4fe658e6790995b962dcb100720_6_1679928818796',
    '__jda': '243069271.16637696330571646021827.1663769633.1679928093.1679928243.29',
    '__jdc': '243069271',
    'unpl': 'JF8EAMpnNSttWR5WDU5RG0ETTltRW1VfSh4GamEBAA9ZTVQEGQQYG0R7XlVdXxRKFR9sYRRXXlNPUA4fAysSEXteXVdZDEsWC2tXVgQFDQ8VXURJQlZAFDMHDlpfGB8KbDVRXV5dHF0HEgFPFxhJXlRbDlgYFVBvZjVkXlh7VAQrAhwVEk1aXFlfCkoTBW9gAFNcW0tdBh0yGiIXe21kW1QNTh8GX2Y1VW0aHwgCHgAeFxkGXVNZXw5MHwRtZQRQW1hMUQIaARsbE01tVW5e',
    'wxa_level': '1',
    'retina': '1',
    'cid': '9',
    'wqmnx1': 'MDEyNjM2NTpkPz10dHJpbiZlY21hXzFhbiZlNmM4OWFfOTQwZTM5bDB1ZDZlIC9ObGkuSGxlQy8ub1MvNkYybi0zUVVPKiZI',
    'jxsid': '16799289511481289297',
    'appCode': 'ms0ca95114',
    'webp': '1',
    '__jdb': '243069271.24.16637696330571646021827|29.1679928243',
    '__jdv': '243069271%7Cbaidu-pinzhuan%7Ct_288551095_baidupinzhuan%7Ccpc%7Cba6fb982ce824f8382e493214bab3b10_0_0d39db1b247449f084475ec07103728e%7C1679928951217',
    'mba_muid': '16637696330571646021827',
    'mba_sid': '16799289512205861182203765065.1',
    'CA1AN5BV0CA8DS2E3F': 'c52772f75ad4e5e35877ff26655c9e9e',
    'FFA9D23F7A4B3CSS': '1acef0618fa035ed426945815254997e',
    'cd_eid': 'jdd03VJLAKPFVJKFZSK5JQI4IZDKVRFR7RJFQOYBTFFEM4PUUAFC2DVWIKQGRU7NT5AJMKGQD3HPU4YX2Q54E2QJR3HK35IAAAAMHEOHK5IAAAAAACJXS3N753OHT6AX',
    'visitkey': '9211044660941584249',
    '3AB9D23F7A4B3CSS': 'jdd03VJLAKPFVJKFZSK5JQI4IZDKVRFR7RJFQOYBTFFEM4PUUAFC2DVWIKQGRU7NT5AJMKGQD3HPU4YX2Q54E2QJR3HK35IAAAAMHEOIYHGAAAAAACVZ5GMI7AAT3PQX',
    '__jd_ref_cls': 'MGuessYouLike_ProExpo',
}

headers = {
    'authority': 'api.m.jd.com',
    'accept': 'application/json',
    'accept-language': 'zh-CN,zh;q=0.9',
    # 'cookie': 'shshshfpa=e3434066-7c6b-cbb2-eec0-0281f8037ee3-1643567850; shshshfpb=bpWSgf9qV6ae2dzFR9JxtMw; __jdu=16637696330571646021827; pinId=vbCchuSa_NQKSbvfzEC03bV9-x-f3wj7; b_dw=1512; b_dh=834; b_dpr=2; b_webp=1; b_avif=1; unick=jd_183368wbf; _tp=yffpj4pbi6WVLmf%2BbKimWgj7K7xxpICgwOKfwjBeIM0%3D; _pst=jd_785d2089dc239; shshshfpx=e3434066-7c6b-cbb2-eec0-0281f8037ee3-1643567850; pin=jd_785d2089dc239; areaId=12; ipLoc-djd=12-988-993-58088; PCSYCityID=CN_320000_320500_0; TrackID=1MzBljf882tTrpTsVJ8KJPp-H6jsNgUzoZxwpqBvrPEvfeWMv9UwhC4NYXRdMP_q8Q_MItygnvR4ovCcrkeA1lJUhPfQhnqLuONzttFOadlJ-lv2TKKMA9Mt7ZxbmjRwu; ceshi3.com=103; auid=19705016; autype=0; auname=jd_183368wbf; aupic=https%3A%2F%2Fstorage.360buyimg.com%2Fi.imageUpload%2F6a645f3738356432303839646332333931353736383130363132353537_big.jpg; disour=1; jsavif=1; shshshfp=577897c2824a85ebbd0fc42d2e96a54d; thor=AABCE4359EC6604D1E910EABE31C93AA7FCF79DDC53AF27CFC346701D54E27E7BD6F4387BF6B4637F9BB96B4F9B681FF69E161721CA72090BE8056BDC34ED3664FA4F407600A6E8262D08907024D75CD46AE6E9CD270BBA7F202AD87E2002F431059F891204620A068009E9F6964A5D98946AED2A1CB01A0A1E7D6ED9D229C33A1131C086FCD6FFBF3C9432A27410A0844DFFD0EA0A61BC29275451925383013; 3AB9D23F7A4B3C9B=VJLAKPFVJKFZSK5JQI4IZDKVRFR7RJFQOYBTFFEM4PUUAFC2DVWIKQGRU7NT5AJMKGQD3HPU4YX2Q54E2QJR3HK35I; shshshsID=d50ad4fe658e6790995b962dcb100720_6_1679928818796; __jda=243069271.16637696330571646021827.1663769633.1679928093.1679928243.29; __jdc=243069271; unpl=JF8EAMpnNSttWR5WDU5RG0ETTltRW1VfSh4GamEBAA9ZTVQEGQQYG0R7XlVdXxRKFR9sYRRXXlNPUA4fAysSEXteXVdZDEsWC2tXVgQFDQ8VXURJQlZAFDMHDlpfGB8KbDVRXV5dHF0HEgFPFxhJXlRbDlgYFVBvZjVkXlh7VAQrAhwVEk1aXFlfCkoTBW9gAFNcW0tdBh0yGiIXe21kW1QNTh8GX2Y1VW0aHwgCHgAeFxkGXVNZXw5MHwRtZQRQW1hMUQIaARsbE01tVW5e; wxa_level=1; retina=1; cid=9; wqmnx1=MDEyNjM2NTpkPz10dHJpbiZlY21hXzFhbiZlNmM4OWFfOTQwZTM5bDB1ZDZlIC9ObGkuSGxlQy8ub1MvNkYybi0zUVVPKiZI; jxsid=16799289511481289297; appCode=ms0ca95114; webp=1; __jdb=243069271.24.16637696330571646021827|29.1679928243; __jdv=243069271%7Cbaidu-pinzhuan%7Ct_288551095_baidupinzhuan%7Ccpc%7Cba6fb982ce824f8382e493214bab3b10_0_0d39db1b247449f084475ec07103728e%7C1679928951217; mba_muid=16637696330571646021827; mba_sid=16799289512205861182203765065.1; CA1AN5BV0CA8DS2E3F=c52772f75ad4e5e35877ff26655c9e9e; FFA9D23F7A4B3CSS=1acef0618fa035ed426945815254997e; cd_eid=jdd03VJLAKPFVJKFZSK5JQI4IZDKVRFR7RJFQOYBTFFEM4PUUAFC2DVWIKQGRU7NT5AJMKGQD3HPU4YX2Q54E2QJR3HK35IAAAAMHEOHK5IAAAAAACJXS3N753OHT6AX; visitkey=9211044660941584249; 3AB9D23F7A4B3CSS=jdd03VJLAKPFVJKFZSK5JQI4IZDKVRFR7RJFQOYBTFFEM4PUUAFC2DVWIKQGRU7NT5AJMKGQD3HPU4YX2Q54E2QJR3HK35IAAAAMHEOIYHGAAAAAACVZ5GMI7AAT3PQX; __jd_ref_cls=MGuessYouLike_ProExpo',
    'origin': 'https://m.jd.com',
    'referer': 'https://m.jd.com/',
    'sec-ch-ua': '"Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"',
    'sec-ch-ua-mobile': '?1',
    'sec-ch-ua-platform': '"Android"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-site',
    'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Mobile Safari/537.36',
}


def getItemId():
    params = {
        'appid': 'jd-cphdeveloper-m',
        'functionId': 'recommend_like_m',
        'body': '{"func":"item_rec","recpos":"6163","param":"{\\"pagenum\\":3,\\"pagecount\\":20,\\"startpos\\":40,\\"ptag\\":\\"\\",\\"sku\\":\\"\\",\\"cid1\\":\\"\\",\\"cid2\\":\\"\\",\\"cid3\\":\\"\\"}","clientPageId":"","clientVersion":"2.0"}',
        'h5st': '20230327225848035;3013955467829311;2088b;tk03wbc341c9318nx1Yim8KvxRsIMVwDr7BRO_1BTKjSrck1ChbRDZZiHdpSHxZZPgRZXZalL7SXfLdy5Ge_NRf6HfqE;85e2a436fefc0d0fc4dde004a299002382540637e54fdf08324cdd1208868b43;3.1;1679929128035;62f4d401ae05799f14989d31956d3c5ff69bf9d5a722facd4df405c9452a670e06cef39a50ad1e9b78fa7ec6af1b14462c66909b783cc0ffb13050ced02e4907365c543e45b2d99c8bfda0fbae029c432776c071fcede62b0dd942e06314e6d88acf0c4b283d1f0e3fee30e78cf07b916ee54481628ebeb5ec23a83ce393d820',
        'x-api-eid-token': 'jdd03VJLAKPFVJKFZSK5JQI4IZDKVRFR7RJFQOYBTFFEM4PUUAFC2DVWIKQGRU7NT5AJMKGQD3HPU4YX2Q54E2QJR3HK35IAAAAMHEOHK5IAAAAAACJXS3N753OHT6AX',
        'loginType': '2',
    }
    response = requests.get('https://api.m.jd.com/api', params=params, headers=headers)
    json_data = response.json()
    datas = json_data['data']['feeds']['content']
    listDir = {}
    for data in datas:
        # print(data['id']+"===="+data['name'])
        listDir[data['id']] = data['name']
    return listDir
if __name__ == '__main__':
    listDir = getItemId()
    print(listDir)